﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using BusinessLogic;

namespace thdescritorio
{
    public partial class frmLogin : Form
    {
        public frmLogin()
        {
            InitializeComponent();
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            try{
                long nroFun = long.Parse(txtNroFun.Text);
                string pass = txtPass.Text;
                Persona unaP = BusinessLogic.Sistema.getInstancia().verifRolFuncionario(nroFun, pass);
                if (unaP.GetType().ToString() == "BusinessLogic.Administrador")
                {
                    Program.authlog = true;
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Error al loguear. \n El Numero de Funcionario o la contraseña no son validos");
                }
            }
            catch(Exception ex){
                MessageBox.Show("Error al loguear.");
            }
        }

        private void frmLogin_Load(object sender, EventArgs e)
        {

        }
    }
}
